<?php

namespace Home\Controller;
use Home\Core\VmsSDK;

class SipUserController extends BaseController
{
    public function userList()
    {
        $param = I('get.');
        if(empty(I('get.page'))){
            $param['page']=1;
        }else{
            $param['page']=I('get.page');
        }
        $page=$param['page'];
        $param['pagesize'] = PAGE_SIZE;
        $sdk = new VmsSDK();
        $return = $this->http_request($sdk::UserList,$param,'GET');
        $array =  json_decode( json_encode( $return ), true );
        $pagesum=$return->pagesum;
        $this->assign('page',$page);
        $this->assign('pagesum',$pagesum);
        $this->assign('array',$array);
        $this->display();
    }

    public function setAddUser()
    {
        $param = I('get.');
        $sdk = new VmsSDK();
        $return = $this->http_request($sdk::UserOne,$param,'GET');
        $array =  json_decode( json_encode( $return ), true );
        $this->assign('array',$array);
        $this->display();

    }
    public function addUser_post()
    {
        $param = I('post.');
        $sdk = new VmsSDK();
        $return = $this->http_request($sdk::UserAdd,$param,'GET');
        $result = $return->result;//获取result的值
        $this->ajaxReturn($result);
    }
    public function UserOne()
    {
        $param = I('get.');
        $sdk = new VmsSDK();
        $return = $this->http_request($sdk::UserOne,$param,'GET');
        $array =  json_decode( json_encode( $return ), true );
        $this->assign('array',$array);
        $this->display();
    }
    public function UpdateUser()
    {
        $param = I('post.');
        $sdk = new VmsSDK();
        $return = $this->http_request($sdk::UserUpdate,$param,'GET');
        $result = $return->result;//获取result的值
        $this->ajaxReturn($result);
    }
    public function UserDel()
    {
        $param = I('post.');
        $sdk = new VmsSDK();
        $return = $this->http_request($sdk::UserDel,$param,'GET');
        $result = $return->result;//获取result的值
        $this->ajaxReturn($result);
    }

}